home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / LNSEFCTS.ZIP / CUSTOM.LFX < prev    next >
Encoding:
Text File  |  1997-07-18  |  3.6 KB  |  81 lines

  1. // LENS EFFECTS: CUSTOM EFFECT FILE
  2. // ********************************
  3. // This file illustrates how you can use create custom effect files
  4. // using any of POVRay's texturing features.  Use this file as a
  5. // guide to creating your own custom effect files.
  6. //
  7. // STEP 1: Creating the lens effect object
  8. // ***************************************
  9. // The features of the lens effects are created using discs textured
  10. // with semi-transparent pigments.  These discs are then rotated and
  11. // translated into the correct position, determined by the various
  12. // camera options and the effect_location option.  The first step is
  13. // to create the basic, unpigmented disc, which you do by invoking
  14. // the _LE_baseobj object:
  15.  
  16.    object {_LE_baseobj
  17.  
  18. // STEP 2: Texturing the lens effect object
  19. // ****************************************
  20. // The next step is to add the desired pigment to the disc.  Although
  21. // any pigment can be used, it is generally best to use some variation
  22. // of the onion pattern.  To make the custom effect file as flexible as
  23. // possible you want it to properly respond to the effect_colour,
  24. // source_colour, effect_brightness, and effect_intensity options.
  25. // To do this, you should specify colours using either the source_colour
  26. // (NOT source_color) variable, or the _LE_colour variable if you want
  27. // it be coloured with the effect_colour.  You can also use multiples
  28. // of these variables.  You should then add the following to the pigment:
  29. //
  30. //    transmit pow(.5, _LE_intensity)
  31. //
  32. // changing the .5 to reflect the desired intensity.  If you want a section
  33. // of the pigment to be completely transparent you can just use:
  34. //
  35. //    transmit 1
  36. //
  37. // but if you want to make sections of the pigment opaque, do NOT use
  38. // transmit 0.  Instead, use a small number in the pow() statement, eg:
  39. //
  40. //    transmit pow(.1, _LE_intensity)
  41. //
  42. // In the following example we use an onion pigment, which starts with
  43. // a turbulent bozo pattern in the centre and fades to a transparent
  44. // effect_colour (note the colours and the transmit values used):
  45.  
  46.    pigment {onion pigment_map {
  47.       [.4 bozo color_map {
  48.          [0 rgb 1.1 * source_colour transmit pow(.5, _LE_intensity)]
  49.          [.8 rgb _LE_colour transmit 1]}
  50.          scale .15 turbulence 2 octaves 3]
  51.       [1 rgb _LE_colour transmit 1]}
  52.       scallop_wave scale 2}
  53.  
  54. // STEP 3: Positioning the lens effect object
  55. // ******************************************
  56. // The final step is to correctly size and position the disc.  First you
  57. // must scale it by a factor of _LE_scale, and then you should rotate it
  58. // by _LE_rotate around the z axis (the .3 means the disc takes up approx.
  59. // 30% of the image):
  60.  
  61.    scale .3 * _LE_scale
  62.    rotate z * _LE_rotate
  63.  
  64. // Then you MUST add the following line to correctly position and layer
  65. // the disc (DO NOT ALTER THIS LINE):
  66.  
  67.    translate _LE_translate scale _LE_lensscale #declare _LE_lensscale = _LE_lensscale + _LE_layersep
  68.    }
  69.  
  70. // If you use multiple discs you MUST add the above line to EVERY disc
  71. // you use, unless you are sure the discs don't overlap (in which case
  72. // you can union the discs together, and add the above line to the union).
  73. //
  74. // For more examples of custom effect files, see the Fireball.lfx and
  75. // Spiral.lfx files.  To see how you can combine these files with existing
  76. // lens effects components, see the CustLFX.pov scene.  If you want to
  77. // create modified versions of existing lens effects components, you should
  78. // copy the relevant code from LnsEfcts.inc (although keep in mind
  79. // all the information above regarding colours, transmit values, scaling,
  80. // rotating, and positioning).
  81.